﻿@model ScmSafetyknowledgeViewModel
@{
    Layout = null;
    ViewBag.Title = "安全知识添加";
}
<script src="/Scripts/jQuery/jquery.validate.min.js" type="text/javascript"></script>
<script src="/Scripts/jQuery/jquery.validate.unobtrusive.min.js" type="text/javascript"></script>


@{Html.EnableClientValidation();}
@using (Html.BeginForm("SafeTrainningAddHandle", "ScmSafeTraining", null, FormMethod.Post, new { onsubmit = "return validateCallback(this,dialogRefresh);", @class = "pageForm required-validate" }))
{

    @Html.HiddenFor(model => model.TheSafetyKnowledge.Sk_ID)
    @Html.HiddenFor(model => model.TheSafetyKnowledge.Sk_PublishOrgID)
    @Html.HiddenFor(model => model.TheSafetyKnowledge.Sk_CreateUserID)
    @Html.HiddenFor(model => model.TheSafetyKnowledge.Sk_CreateName)
    <input id="OperationType" name="OperationType" value="@ViewBag.OperationType" type="hidden" />
    <input id="KnowledgeType" name="KnowledgeType" value="@ViewBag.type" type="hidden" />
    <input id="AssistID" name="AssistID" value="@ViewBag.AssisId" type="hidden" />
        <div class="pageFormContent sortDrag" layouth="58">
        <table class="tab01 tabNo" width="100%;">
            <tr>
                <td class="td1" style="width:25%;">发布机构：</td>
                <td id="td_train_@(ViewBag.type)">
                    @Html.TextBoxFor(model => model.TheSafetyKnowledge.Sk_PublishOrgName, new { @class="input02" })
                </td>
            </tr>
            <tr>
                <td class="td1">发布日期：</td>
                <td>
                    @Html.TextBoxFor(model => model.TheSafetyKnowledge.Sk_CreateTime, new { @class = "date input02", @readonly = "true", Value = @Model.TheSafetyKnowledge.Sk_CreateTime.ToString("yyyy-MM-dd") })
                </td>
            </tr>
            <tr>
                <td class="td1">@(ViewBag.typeName)：</td>
                <td>
                    @Html.TextBoxFor(model => model.TheSafetyKnowledge.Sk_Title, new Dictionary<string, object> { { "class", "data-val-required input02" }})
                    @Html.ValidationMessageFor(model => model.TheSafetyKnowledge.Sk_Title)

                </td>
            </tr>
            <tr>
                <td class="td1">内容：</td>
                <td>
                    @Html.TextAreaFor(model => model.TheSafetyKnowledge.Sk_Content, new { @class = "editor", rows = "18", cols = "82" })
                </td>
            </tr>
            <tr>
                <td class="td1">附件：</td>
                <td>
                    <a href='/Common/UploaderFile/Uploader/?id=ZDFileID' width="710" height="460" rel="rel_WorkFlow_WorksMeasure_Attach" mask="true" target="dialog" title="附件管理">
                        <img src="/Content/themes/default/images/fj.gif" alt="查看附件" id='ZDFileID'
                             uploaderoption="{MoudleID:@ViewBag.MoudleID,'ToSelectIDs':[@ViewBag.FileIds],'ToDeleteIDs':[@ViewBag.DeleteIds],BizDeleteURL:'/SafetyConstruction/Base/Delete/',BizSaveUrl:'/SafetyConstruction/Base/BatchAdd/',BizType:'SafeKnowledge_Rules',BizID:'@ViewBag.AssisId','dirWhere':'@ViewBag.DirWhere'}" />
                    </a>
                </td>
            </tr>
            </table>
        </div>
        <div class="formBar">
            <ul>
                @if (ViewBag.OperationType != "view")
                {
                    <li>
                        <button type="submit" class="btn btn-sm">保存</button>
                    </li>
                }

                <li>
                    <button type="button" onclick="focusInput()" class="btn btn-default btn-sm">取消</button>
                </li>
            </ul>
        </div>

}

<script type="text/javascript">
    $(document).ready(function () {
        var obj = $("#td_train_@(ViewBag.type) input:eq(0)");
        obj.focus();
    });

    function dialogRefresh(json) {
        DWZ.ajaxDone(json);
        if (json.statusCode == DWZ.statusCode.ok) {
            $("#pagerForm", navTab.getCurrentPanel()).submit();
            focusInput();
        }
    }
    
    function focusInput()
    {
        $("#li_train_@(ViewBag.type) input:eq(0)").focus();
        $.pdialog.closeCurrent();
    }
</script>


